home *** CD-ROM | disk | FTP | other *** search
/ com!online 2002 July / com!online0702.iso / software / livemotion / DATA1.CAB / Automation / Scripts / Effect - Dissipate Exit.js < prev    next >
Encoding:
Text File  |  2002-05-13  |  3.7 KB  |  120 lines

  1. /***************************************************************
  2. ADOBE SYSTEMS INCORPORATED 
  3. Copyright 2001 Adobe Systems Incorporated 
  4. All Rights Reserved 
  5.  
  6. NOTICE:  Adobe permits you to use, modify, and distribute this 
  7. file in accordance with the terms of the Adobe license agreement 
  8. accompanying it.  If you have received this file from a source 
  9. other than Adobe, then your use, modification, or distribution
  10. of it requires the prior written permission of Adobe. 
  11. ***************************************************************/
  12. /***************************************************************
  13. Author: Mary Obelnicki
  14. ***************************************************************/
  15.  
  16. /***************************************************************
  17.  
  18. The following script creates a key frame animation effect on 
  19. the currently selected objects.
  20.  
  21. Function:
  22.     dissipate(letters, frames, stagger, opacity, rotation, xdiff, ydiff, scale, forward, startNow) 
  23.     
  24. Arguments:
  25.     <letters> LMObject - an array of the objects to apply the 
  26.         effect. Does not have to be text objects.  It can be 
  27.         any LMObject.
  28.     <frames> integer - the length of the animation for each 
  29.         object
  30.     <stagger> integer - the number of frames to stagger the 
  31.         start of each animation
  32.     <opacity> integer - the opacity to end at
  33.     <rotation> integer - the rotation to end at
  34.     <xdiff>, <ydiff> integer - the x, y difference from the 
  35.         initial position to end at.  In screen coords.
  36.     <scale> integer - scale of original size to end at. 
  37.         1=same size, 2=double size 
  38.     <forward> boolean - stagger from first character or 
  39.         last character
  40.     <startNow> boolean - should the animation start now, at 
  41.         the current frame, or end now. 
  42.     
  43. ***************************************************************/
  44.  
  45. /***************************************************************
  46. To change the behavior of this script, 
  47. make your changes below
  48. ***************************************************************/
  49.  
  50. objects = application.currentComposition.selection;
  51.  
  52. dissipate( objects, 12, 2, 0, -360, 100, 100, 3, true, true); 
  53.  
  54. /***************************************************************
  55. DO NOT EDIT BELOW THIS LINE
  56. ***************************************************************/
  57.  
  58.  
  59.  
  60. function dissipate(letters, frames, stagger, opacity, rotation, xdiff, ydiff, scale, forward, startNow) 
  61. {     
  62.     if(letters.length < 1)
  63.     return; 
  64.     //the first frame
  65.     var frame0;
  66.     if (startNow)
  67.      frame0 = letters[0].currentFrame;
  68.     else
  69.     frame0 = letters[0].currentFrame - (stagger * (letters.length - 1) + frames); 
  70.     
  71.     for (i=0; i < letters.length; i++)
  72.     {
  73.     var cl; //the current letter
  74.     if (forward)
  75.         cl = letters[i];
  76.     else
  77.         cl = letters[letters.length -1 -i];
  78.  
  79.     //the initial values
  80.     var xo = cl.position.x; 
  81.     var yo = cl.position.y;
  82.     var oriOpacity = cl.opacity; 
  83.     var oriRotation = cl.rotation;
  84.     var oriScalex = cl.scale.x; 
  85.     var oriScaley = cl.scale.y; 
  86.     
  87.     //turn on relevant stopwatches    
  88.     
  89.     if (opacity != oriOpacity)
  90.         cl.stopwatch.opacity = true;     
  91.     if (rotation != oriRotation) 
  92.         cl.stopwatch.rotation = true; 
  93.     if (scale !=100) 
  94.         cl.stopwatch.scale = true; 
  95.     
  96.     if((xdiff != 0) || (ydiff != 0))
  97.         cl.stopwatch.position = true; 
  98.     
  99.     //first frame
  100.     cl.currentFrame = frame0 + (i * stagger);
  101.     cl.position.x = xo; 
  102.     cl.position.y = yo; 
  103.     cl.scale.x = oriScalex; 
  104.     cl.scale.y = oriScaley; 
  105.     cl.opacity = oriOpacity;
  106.     cl.rotation = oriRotation;
  107.     
  108.     //last frame    
  109.     cl.currentFrame = frame0 + frames + (i * stagger);
  110.     cl.position.x = xo + xdiff; 
  111.     cl.position.y = yo + ydiff; 
  112.     cl.opacity = opacity;
  113.     cl.rotation = rotation; 
  114.     cl.scale.x = oriScalex * scale/100; 
  115.     cl.scale.y = oriScaley * scale/100; 
  116.     
  117.     }
  118. }; 
  119.  
  120.